﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using yCloud;

namespace Host
{
    class Program
    {
        static void Main(string[] args)
        {
            ServiceHost userServiceHost = new ServiceHost(typeof(YCloudService));
            try
            {
                userServiceHost.Open();
            }
            finally
            {
                Console.WriteLine("Press <ENTER> to terminate host.");
                Console.ReadLine();
                CloseHost(userServiceHost);
            }
        }
        static void CloseHost(ServiceHost host)
        {
            if (host.State == CommunicationState.Faulted)
                host.Abort();
            else
                host.Close();
        }
    }
}
